// 导入request.js请求工具
import request from '@/utils/request.js'
// 菜品管理相关接口

// 获取菜品page的接口
export const getDishPageApi = (params) => {
    return request.get('/dish/page', {
        params
    })
}

// 修改菜品的接口
export const editDishApi = (params) => {
    return request.put('/dish', params);
}

// 删除菜品的接口
export const deleteDishApi = (i) => {
    return request.delete('/dish', {
        params: {
            ids: i
        }
    });
}

// 添加菜品的接口
export const addDishApi = (params) => {
    return request.post('/dish', params);
}


// 查询详情
export const queryDishByIdApi = (id) => {
    return request.get(`/dish/${id}`)
}

// 获取菜品分类列表
export const getCategoryListApi = (params) => {
    return request.get('/category/list', {
        params
    })
}

// 查菜品列表的接口
export const queryDishListApi = (params) => {
    return request.get('/dish/list', {
        params
    })
}

// 文件down预览
export const commonDownloadApi = (params) => {
    return request.get('/common/download', { params }, { headers: { 'Content-Type': 'multipart/form-data' } })
}

// 起售停售---批量起售停售接口
export const dishStatusByStatusApi = (params) => {
    return request.post(`/dish/status/${params.status}`,null,{
        params: { ids: params.id }
    })
}